//
//  YIem_FindCollectionViewCell.m
//  B段_开眼
//
//  Created by YIem on 16/4/23.
//  Copyright © 2016年 Howie. All rights reserved.
//

#import "YIem_FindCollectionViewCell.h"

@interface YIem_FindCollectionViewCell ()
@property (nonatomic, strong) UIImageView *imageBack;
@property (nonatomic, strong) UIView *imageView;
@property (nonatomic, strong) UILabel *labelTitle;

@end

@implementation YIem_FindCollectionViewCell
- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
       
        self.imageBack = [[UIImageView alloc]init];
        [self.contentView addSubview:_imageBack];
        self.imageView = [[UIView alloc] init];
        self.imageView.backgroundColor = [UIColor blackColor];
        self.imageView.alpha = 0.2;
        [self.imageBack addSubview:self.imageView];
        
        self.labelTitle = [[UILabel alloc] init];
        self.labelTitle.font = [UIFont systemFontOfSize:22];
        self.labelTitle.textColor = [UIColor whiteColor];
        self.labelTitle.textAlignment = NSTextAlignmentCenter;
        [self.imageBack addSubview:_labelTitle];
        
    }
    return self;
}
- (void)setModel:(YIem_FindCellModel *)model
{
    _model = model;
    
    [self.imageBack sd_setImageWithURL:[NSURL URLWithString:model.image]];
    
    self.labelTitle.text = [NSString stringWithFormat:@"%@", model.title];
    
}
- (void)layoutSubviews
{
    [super layoutSubviews];
    
    self.imageBack.frame = CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
    self.imageView.frame = CGRectMake(0, 0, self.imageBack.frame.size.width, self.imageBack.frame.size.height);
    self.labelTitle.frame = CGRectMake(0, 0, self.frame.size.width, 40);
    self.labelTitle.center = CGPointMake(self.frame.size.width / 2, self.frame.size.height / 2);
    
}

@end
